package org.ruanjj.dynamicplanning.maxproduct;

public class Solution {
    public int maxProduct(int[] nums) {
        int n = nums.length;
        int i = 0;
        int maxProductVal = 0;

        while(i < n-1){
            int pre = 1;
            for(int j = i; j < n; j++){
                pre = pre * nums[j];
                maxProductVal = Math.max(maxProductVal, pre);
            }
            i++;
        }

        return maxProductVal;
    }
}
